package com.cjm.one.webmanager.service.system.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.model.system.dto.SysDictDataDto;
import com.cjm.one.model.system.entity.SysDictData;
import com.cjm.one.model.system.entity.SysDictType;
import com.cjm.one.system.client.SysDictClient;
import com.cjm.one.webmanager.service.system.SysDictService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysDictServiceImpl implements SysDictService {
    @Resource
    private SysDictClient sysDictClient;

    @Override
    public List<SysDictType> findAll(SysDictDataDto sysDictDataDto) {
        return sysDictClient.findAll(sysDictDataDto).getData();
    }

    @Override
    public Page<SysDictData> list(SysDictDataDto sysDictDataDto) {
        return sysDictClient.list(sysDictDataDto).getData();
    }

    @Override
    public Boolean save(SysDictData sysDictData) {
        return sysDictClient.saveDictData(sysDictData).getData();
    }

    @Override
    public Boolean updateById(SysDictData sysDictData) {
        return sysDictClient.updateDictData(sysDictData).getData();
    }

    @Override
    public Boolean removeById(Long id) {
        return sysDictClient.deleteDictData(id).getData();
    }

    @Override
    public SysDictData getById(Long id) {
        return sysDictClient.getDictDataById(id).getData();
    }

    @Override
    public Boolean saveDictType(SysDictType sysDictType) {
        return sysDictClient.saveDictType(sysDictType).getData();
    }

    @Override
    public Boolean updateSysDictTypeById(SysDictType sysDictType) {
        return sysDictClient.updateSysDictTypeById(sysDictType).getData();
    }

    @Override
    public Boolean removeSysDictTypeById(SysDictDataDto sysDictDataDto) {
        return sysDictClient.removeSysDictTypeById(sysDictDataDto).getData();
    }

    @Override
    public SysDictType findById(Long id) {
        return sysDictClient.findSysDictTypeById(id).getData();
    }
}
